
function value=gamrnd(shape,scale)


n=shape;

alpha=1/scale;
% generates a random number of Erlang distribution distributed with the mean */
% equal to n/alpha 
x=1.0;
   
    for count=1:n
    ran=rand(1);
    x=x*ran;
    end
    
    x=-log(x);

    value=(x/alpha);
 

  

